package cn.szzsi.programmer.controller;

import cn.szzsi.common.util.CommonUtil;
import com.jfinal.aop.Clear;
import com.jfinal.core.Controller;
import com.jfinal.kit.Ret;
import com.jfinal.kit.StrKit;

import javax.servlet.http.Cookie;

/**
 * Created by admin on 2017/7/17.
 */
public class AdminController  extends Controller{

    public void index(){
        render(CommonUtil.TEMPLATE_PATH+"/programmer/admin/index.html");
    }

    @Clear
    public void login(){
        render(CommonUtil.TEMPLATE_PATH+"/programmer/admin/login.html");
    }

    @Clear
    public void signIn(){
        String password=getPara("password");
        if(!"jiuyue!2018".equals(password)){
            renderJson(Ret.fail("info","密码错误!"));
            return;
        }
        Cookie authCookie = new Cookie("programmer","programmer");//登录类型
        authCookie.setPath(getRequest().getContextPath()+"/");
        setCookie(authCookie);
        renderJson(Ret.ok());

    }
}
